package com.wzdigit.wms.basic.mapper.core.transfer;

import com.wzdigit.framework.orm.mybatis.MyBatisRepository;
import com.wzdigit.wms.basic.domain.inventory.Goods;
import com.wzdigit.wms.basic.domain.transfer.CtnrLoading;
import com.wzdigit.wms.basic.domain.transfer.CtnrLoadingGoods;
import com.wzdigit.wms.basic.domain.transfer.GdnDtl;
import com.wzdigit.wms.basic.domain.transfer.GdnDtlGoods;
import com.wzdigit.wms.basic.client.response.transfer.GdnDtlRemoveCount;
import com.wzdigit.wms.basic.client.response.transfer.GdnRemoveCtnrResponse;
import com.wzdigit.wms.basic.client.response.transfer.GdnRemoveDtlResponse;
import com.wzdigit.wms.basic.client.response.transfer.GdnRemoveSnRespone;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 取消装运Mapper
 * Created by zyf on 2021/5/27 15:33
 */
@MyBatisRepository
public interface GdnRemoveCtnrMapper {
    GdnRemoveCtnrResponse selectOneByGoNo(@Param("gdnNo") String gdnNo);

    List<GdnRemoveDtlResponse> selectDtlByHeader(@Param("gdnHeaderId") BigDecimal gdnHeaderId);

    List<GdnRemoveSnRespone> selectSnByHeader(@Param("gdnHeaderId") BigDecimal gdnHeaderId,
                                              @Param("goodsSn") String  goodsSn);

    GdnRemoveSnRespone  selectSnByHeaderAndSn(@Param("gdnHeaderId") BigDecimal gdnHeaderId,
                                              @Param("goodsSn") String  goodsSn);

    List<GdnRemoveSnRespone> selectSimpleRemoveSn(@Param("gdnHeaderId") BigDecimal gdnHeaderId,
                                                     @Param("goodsSns") List<String>  goodsSns);

    //查询SN显示信息
    List<GdnRemoveSnRespone> selectShowRemoveSn(@Param("gdnHeaderId") BigDecimal gdnHeaderId,
                                                @Param("goodsSn") String goodsSns);

    //查询SN计算信息
    List<GdnRemoveSnRespone> selectCountRemoveSn(@Param("gdnHeaderId") BigDecimal gdnHeaderId,
                                                @Param("goodsSn") String goodsSns);

    //查询发货单下所有的SN信息
    List<String> selectAllGdnGoods(@Param("gdnHeaderId") Long gdnHeaderId);

    BigDecimal selectDtlOrderQtysBySns(@Param("gdnNo") String gdnNo,
                                       @Param("goodsSns") List<String> goodsSns);

    Integer selectDtlOrderQtysBySn(@Param("gdnNo") String gdnNo,
                                       @Param("goodsSns") List<String> goodsSns);

    BigDecimal selectRemoveQtysBySns(@Param("gdnNo") String gdnNo,
                                     @Param("goodsSns") List<String> goodsSns);

    Integer selectRemoveQtysBySn(@Param("gdnNo") String gdnNo,
                                     @Param("goodsSns") List<String> goodsSns);

    List<GdnDtlGoods> selectDtlGoodsByNoAndSn(@Param("gdnNo") String gdnNo,
                                              @Param("goodsSns") List<String> goodsSns);

    List<GdnDtl> selectByGdnNoAndSn(@Param("gdnNo") String gdnNo,
                                    @Param("goodsSn") String goodsSn);

    List<GdnDtlRemoveCount> selectSimpleDtlCount(@Param("gdnNo") String gdnNo,
                                                 @Param("goodsSns") List<String> goodsSns);

    List<GdnDtlRemoveCount> selectDtlCount(@Param("gdnNo") String gdnNo,
                                                 @Param("goodsSns") List<String> goodsSns);

    List<CtnrLoading> selectCtnr(@Param("gdnDtlId") BigDecimal gdnDtlId,
                                 @Param("gdnNo") String gdnNo);

    Integer selectDtlCountByHeaderAndStatus(@Param("headerId")Long headerId,@Param("status") Integer status);

    CtnrLoadingGoods selectCtnrGoods(@Param("dto") GdnDtlRemoveCount dto);

    int updateGoodsBySn(@Param("goods") Goods goods);

    int updateGdnDtlByIdAndStatus(@Param("gdnDtl") GdnDtl gdnDtl,@Param("status") Integer status);

    int updateAsnDtlStatus(@Param("dtlIds") List<Integer> dtlIds,@Param("status") Integer status);

    int updateTrasnfetDtlStatus(@Param("headerId") Integer headerId,@Param("status") Integer status);

    int updateGdnDtlNew(@Param("gdnDtlId") BigDecimal gdnDtlId, @Param("user") String user,
                     @Param("date")Date date,@Param("qty") BigDecimal qty);

    int updateCntrLoadingNew(@Param("ctnrLoadingId") Integer ctnrLoadingId, @Param("user") String user,
                     @Param("date")Date date,@Param("qty") BigDecimal qty);

    int udateCtnrLoading(@Param("ctnrLoading") CtnrLoading ctnrLoading,@Param("status") Integer status);

    //更新状态
    int updateDtlStatusNew(@Param("gdnDtlId") Long gdnDtlId,@Param("status") Integer status);

    int updateCtnrStatusNew(@Param("ctnrId") Integer ctnrId,@Param("status") Integer status);

    int deleteGdnDtlGoodSn(@Param("dtlGood") GdnDtlRemoveCount gdnDtlRemoveCount);
}
